<template>
  <div>
    <div>
      <el-form :inline="true" size="medium">
        <el-form-item>
          <el-input
            placeholder="用户昵称/手机号码"
            v-model="queryObj.query_value"
          >
          </el-input>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="getMainListReset"
            ><i class="iconfont icon-search"></i>查询</el-button
          >
        </el-form-item>
      </el-form>
    </div>
    <div class="mytable">
      <el-table
        :data="mainList"
        tooltip-effect="dark"
        stripe
        style="width: 100%"
      >
        <el-table-column label="卡号" width="100">
          <template slot-scope="scope">
            {{ scope.row.member_card }}
          </template>
        </el-table-column>
        <el-table-column label="会员等级" width="100">
          <template slot-scope="scope">
            {{ scope.row.member_name }}
          </template>
        </el-table-column>
        <el-table-column label="金额（元）" width="100">
          <template slot-scope="scope">
            {{ scope.row.price | yuanToFen}}
          </template>
        </el-table-column>
        <el-table-column label="头像">
          <template slot-scope="scope">
            <img class="headimg" :src="imgUrl + scope.row.user_head_img" alt="">
          </template>
        </el-table-column>
        <el-table-column label="手机号码" width="120">
          <template slot-scope="scope">
            {{ scope.row.mobilenum }}
          </template>
        </el-table-column>
        <el-table-column label="性别">
          <template slot-scope="scope">
            {{ scope.row.sex == '1' ? '男' : '女' }}
          </template>
        </el-table-column>
        <el-table-column label="昵称">
          <template slot-scope="scope">
            {{ scope.row.user_nickname }}
          </template>
        </el-table-column>
        <el-table-column label="地区">
          <template slot-scope="scope">
            {{ scope.row.user_area }}
          </template>
        </el-table-column>
        <el-table-column label="积分">
          <template slot-scope="scope">
            {{ scope.row.TODO || '还没字段' }}
          </template>
        </el-table-column>
        <el-table-column label="开通时间" width="200">
          <template slot-scope="scope">
            {{scope.row.init_time | formatDate('yyyy-MM-dd hh:mm:ss')}}
          </template>
        </el-table-column>
      </el-table>
      <el-pagination
        class="pagecon"
        background
        layout="total, sizes, prev, pager, next"
        @current-change="_mainList"
        @size-change="_mainList"
        :page-size.sync="page.limit"
        :page-sizes="pageSizeArr"
        :current-page.sync="page.page"
        :total="page.total"
      >
      </el-pagination>
    </div>

  </div>
</template>

<script>
import memberRecordAPI from 'api/memberManagement/memberRecordAPI';
import { pageSizeArr } from "common/config/constConfig";
import config from "api/config";

export default {
  components: {},
  computed: {},
  data() {
    return {
      // statusList: line_audit_status,
      // lineStatus: line_status,
      // auditList: [],
      imgUrl: config.imgUrl,
      dialogTableVisible: false,
      pageSizeArr,
      queryObj: {},
      mainList: [],
      seriesList: [],
      comboList: [],
      page: {
        total: 0,
        page: 1,
        limit: 10
      }
    };
  },
  methods: {

    goto() {
      // let data = {path: '/home/discountCouponDetail'}
      // this.setDiscountCouponObj({...row})
      // this.$router.push(data)
    },
    // filter fun
    _caozuoAfter(msg) {
      this.dialogFormVisible = false;
      this.$message({
        message: msg,
        type: "success"
      });
      this._mainList();
    },
    getMainListReset() {
      this.page.page = 1;
      this._mainList();
    },
    // 获取
    _mainList() {
      let data = { ...this.queryObj };
      data.pageInfo = { ...this.page };
      memberRecordAPI('get', data).then(res => {
        let pageInfo = res.pageInfo;
        this.page.total = pageInfo.Total;
        this.page.page = pageInfo.page;
        this.mainList = res.rData
      });
    },
  },
  created() {
    this._mainList();
  }
};
</script>

<style lang="scss" scoped>
.headimg{
  height: 60px;
  width: 60px;
  border-radius: 50%;
}
</style>
